classes = [
    {"name": "n_1", "age": 24, "grade": "A"},
    {"name": "n_2", "age": 23, "grade": "B"},
    {"name": "n_3", "age": 28, "grade": "A"},
    {"name": "n_4", "age": 24, "grade": "A"},
    {"name": "n_5", "age": 25, "grade": "C"},
    {"name": "n_6", "age": 21, "grade": "D"},
    {"name": "n_7", "age": 27, "grade": "A"},
]

#根据grade排序
a = classes
a. sort(key=lambda x: x["grade"])
print(a)

# 通过filter筛选出grade为A的同学
b = filter(lambda x: x["grade"] == "A", classes)
print(list(b))



#通过Map函数让每个人的age加1
def add(l):
    l["age"] += 1
    return l
c = list(map(add, classes))
print(c)


#斐波那契递归函数
def f(x):
    if (x <2):
        return x
    else:
        return f(x - 1) + f(x - 2)
for i in range(30):
    print(f(i), end=" ")